const { mock } = require('mockjs')
const Mock = require('mockjs')

const data = Mock.mock({
  'items|5': [{
    id: '@id',
    Title: '@csentence(10, 20)',
    'status|1': ['published', 'draft', 'deleted'],
    author: 'name',
    HeadImg:"@image('200x200','red','#fff','用户头像')",
    RealName: '@datetime',
    AnswerNum: '@integer(300, 5000)',
    CreatTimeTimeShow:'@datetime'
  }]
})

const hotquestions = Mock.mock({
  'items|10': [{
    id: '@id',
    Title: '@csentence(10, 20)',
    'status|1': ['published', 'draft', 'deleted'],
    author: 'name',
    HeadImg:"@image('200x200','red','#fff','用户头像')",
    RealName: '@datetime',
    AnswerNum: '@integer(300, 5000)',
    CreatTimeTimeShow:'@datetime'
  }]
})

const HotTags=Mock.mock({
    'items|5': [{
        id: '@id',
        TagName: '@cword(3,5)',
       
      
      }]
})
const noAnswerQuestions=Mock.mock({
  'items|5': [{
      id: '@id',
      Title: '@csentence(10, 20)',
     
    
    }]
})

const hotAnswerQuestions=Mock.mock({
  'items|5': [{
      id: '@id',
      Title: '@csentence(10, 20)',
     
    
    }]
})

const Nnvigation=Mock.mock({
  'items|5': [{
      id: '@id',
      Title: '@csentence(3, 7)',
     
    
    }]
})

const searchlist=Mock.mock({
  'pagecount':'200',

  'items|10': [{
      id: '@id',
      Title: '@csentence(3, 7)',
      TagName:'@csentence(3, 5)',
      CreateTime:'@datetime',
      HeadImg:"@image('200x200','red','#fff','用户头像')",
      RealName:'@cname',
      'AnswerNum':'@natural(1, 100)',
      CreatTimeTimeShow:'@datetime',
      'ClickNum':"@natural(1, 1000)",
      BestAnswer:'',
    
    }]
})

module.exports = [
  {
    url: '/faq/GetNewQuestions',
    type: 'get',
    response: config => {
      const items = data.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    },

    
  },
  {
    url: '/faq/HotTags',
    type: 'get',
    response: config => {
      const items = HotTags.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/faq/GetHotQuestions',
    type: 'get',
    response: config => {
      const items = hotquestions.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/faq/GetNoAnswerQuestions',
    type: 'get',
    response: config => {
      const items = noAnswerQuestions.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/faq/GetHotAnswerQuestions',
    type: 'get',
    response: config => {
      const items = hotAnswerQuestions.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/faq/GetNavigation',
    type: 'get',
    response: config => {
      const items = navigation.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/faq/GetSearchlist',
    type: 'get',
    response: config => {
      const items = searchlist.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  }

]
